---
id: jsonserializer
title: 7. JsonSerializerUtility 静态类
sidebar_label: 7. JsonSerializerUtility 静态类
---

## 7.1 序列化

```cs
var str = JsonSerializerUtility.Serialize(obj, [options]);
```

## 7.3 反序列化

```cs
var obj = JsonSerializerUtility.Deserialize<T>(str, [options]);
```

## 7.4 获取默认序列化配置

```cs
var options = JsonSerializerUtility.GetDefaultJsonSerializerOptions();
```

## 7.5 设置序列化属性首字母大写

```cs {2}
services.AddControllersWithViews()
        .AddJsonSerializerPascalPropertyNaming();
```

## 7.6 设置时间输出统一格式化

```cs {2}
services.AddControllersWithViews()
        .AddDateTimeJsonConverter("yyyy-MM-dd HH:mm:ss");
```
